


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt"%>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	String applicationPath = basePath + "/" + "application";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet"
			type="text/css" />
		<script language="javascript" src="<%=path%>/js/util.js"></script>
		<script language="javascript" src="<%=path%>/application/js/treeSelect.js"></script>
	</head>
	<body>

		<html:form styleId="yfFeeReimburForm"
			action="listYfFeeReimbur.do?method=getYfFeeReimburPartialList">
			<input type="hidden" id="totalPage" value="${totalPage}" />
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="margtb5">
				<tr>
					<td align="left" class="padl5 lan12">
						<img src="<%=path%>/images/img-11.gif" width="12" height="12"></img>
						研发辅助 &gt; 项目费用 &gt; 费用报销
					</td>
				</tr>
			</table>


			<table cellspacing="3" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margtb5 hei12">
				<tr>
					<td width="10%" align="right">
						<bean:message
							key="com.application.yffeereimbur.entity.yffeereimbur.listpage.operateid"
							bundle="yffeereimbur" />：
					</td>
					<td width="15%">
						<input type="text" value="${yfFeeReimburForm.rname2}" name="rname2" id="rname2" onClick="openTree('divTree','user_bm_o','${pageContext.request.contextPath}/common/treeSelect.jsp?iid=operateid&iname=rname2',this)" />
		
							 <input type="hidden" value="" id="operateid" name="operateid" size="80" />
						 		  	<div id="divTree"
			style="position: absolute; background: #FFFFFF; left: 1px; top: 1px; height =300; width: 253px; display: none"></div>
					</td>
					<td width="10%" align="right">
						<bean:message
							key="com.application.yffeereimbur.entity.yffeereimbur.listpage.org"
							bundle="yffeereimbur" />：
					</td>
					<td width="15%">
						 <ssh:select propertyName="org" firstShow="Y" dataSource="collection" selectList="${orgSelect}"  type="1" defaultName="${yfFeeReimburForm.org}"/> 
					</td>
					<td width="10%" align="right">
						<bean:message
							key="com.application.yffeereimbur.entity.yffeereimbur.listpage.projectNo"
							bundle="yffeereimbur" />：
					</td>
					<td width="15%">
						<html:text property="projectNo" />
					</td>
                    <td width="10%" align="right">
						项目名称：
					</td>
					<td width="15%">
						<html:text property="projectName" />
					</td>
					</tr>
					<tr>
					<td width="10%" align="right">
						<bean:message
							key="com.application.yffeereimbur.entity.yffeereimbur.listpage.feeType"
							bundle="yffeereimbur" />：
					</td>
					<td width="15%">
						<ssh:select propertyName="feeType" pid="FEE_TYPE" type="1"
							defaultName="${yfFeeReimburForm.feeType}" />
					</td>

					<td width="10%" align="right">
						报销状态：
					</td>
					<td width="15%">
							<ssh:select propertyName="auditStatus" pid="AUDIT_STATUS_3" type="1"
							defaultName="${yfFeeReimburForm.auditStatus}" />
					</td>

					



					<td width="12%">
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input class="buttonbg" style="cursor: hand" id="but_query"
							type="button"
							value="<bean:message key='com.manager.common.yffeereimbur.query'  bundle="yffeereimbur"/>"
							name="but_query" onClick="query();" />
					</td>
				</tr>

			</table>


			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="margb5">
				<tr>
					<td colspan="8" class="bgcolor2 padlr5">
						<table border="0" cellspacing="0" cellpadding="0" class="lan13b">
							<tr>
							  <c:if test="${loginUser.isYFZL=='true' || loginUser.isYFRY=='true'  || loginUser.isYFJL=='true'  || loginUser.isFZR=='true'}">
								<td width="25" align="center">
									<img src="<%=applicationPath%>/images/tianjia.gif"
										alt="<bean:message key='com.manager.common.yffeereimbur.add'  bundle="yffeereimbur"/>"
										height="15" width="15" />
								</td>
								<td class="lieb-zi" width="40">
									<a href="#" onClick="addYfFeeReimbur();"><bean:message
											key='com.manager.common.yffeereimbur.add'
											bundle="yffeereimbur" /> </a>
								</td>
								</c:if>
								<td width="25" align="center">
									<img src="<%=applicationPath%>/images/bianji.gif"
										alt="<bean:message key='com.manager.common.yffeereimbur.modify'  bundle="yffeereimbur"/>"
										height="15" width="15" />
								</td>
								<td class="lieb-zi" width="40">
									<a href="#" onClick="modifyYfFeeReimbur();"><bean:message
											key='com.manager.common.yffeereimbur.modify'
											bundle="yffeereimbur" /> </a>
								</td>

								<td width="25" align="center">
									<img src="<%=applicationPath%>/images/shanchu.gif"
										alt="<bean:message key='com.manager.common.yffeereimbur.del'  bundle="yffeereimbur"/>"
										height="15" width="15" />
								</td>
								<td class="lieb-zi" width="40">
									<a href="#" onClick="delYfFeeReimbur();"><bean:message
											key='com.manager.common.yffeereimbur.del'
											bundle="yffeereimbur" /> </a>
								</td>


								<td width="25" align="center">
									<img src="<%=applicationPath%>/images/chakan.gif"
										alt="<bean:message key='com.manager.common.yffeereimbur.view'  bundle="yffeereimbur"/>"
										height="15" width="15" />
								</td>
								<td width="40" class="lieb-zi">
									<a href="#" onClick="view();"><bean:message
											key='com.manager.common.yffeereimbur.view'
											bundle="yffeereimbur" /> </a>
								</td>
								
									<td width="25" align="center">
									<img src="<%=applicationPath%>/images/word.gif"
										alt="导出"
										height="15" width="15" />
								</td>
								<td width="40" class="lieb-zi">
									<a href="#" onClick="exportWord();">导出</a>
								</td>
								
								
									<td width="25" align="center">
									<img src="<%=applicationPath%>/images/bianji.gif"
										alt="导出"
										height="15" width="15" />
								</td>
								<td width="100" class="lieb-zi">
									<a href="#" onClick="modifyStatus();">修改报销状态</a>
								</td>
								
										<td width="25" align="center">
						<img src="<%=applicationPath%>/images/shangbao.gif"
							alt="提交审核"
							height="15" width="15" />
					</td>
					<td width="65" class="lieb-zi">
				        <a href="#" onClick="submitAudit();">提交审核 </a>
					</td>
								<td class="lieb-zi">
									&nbsp;
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>

						<fmt:bundle
							basename="com.application.yffeereimbur.struts.ApplicationResources_yffeereimbur">
							<display:table name="yfFeeReimburList" class="simple"
								id="yfFeeReimburTab" pagesize="15" partialList="true"
								style=" width:100%;" defaultorder="descending" size="resultSize"
								requestURI="listYfFeeReimbur.do?method=getYfFeeReimburPartialList">
								<display:column title="选择" sortable="false"
									style=" width:5%; text-align:center;">
									<input type="hidden" id="${yfFeeReimburTab.id}auditStatus" name="${yfFeeReimburTab.id}auditStatus" value="${yfFeeReimburTab.auditStatus}"/>
									<input type="hidden" id="${yfFeeReimburTab.id}operateid" name="${yfFeeReimburTab.id}operateid" value="${yfFeeReimburTab.operateid}"/>
									<input type="checkbox" name="id" value="${yfFeeReimburTab.id}"
										headerClass="sortable" />
								</display:column>

 
                               <display:column
									titleKey="com.application.yffeereimbur.entity.yffeereimbur.listpage.operateid"
									sortable="true" style="width:5%; text-align:center;">
									 <a style="color:blue;" href="#" onclick="showView('${yfFeeReimburTab.id}')">${yfFeeReimburTab.rname}</a> 
									</display:column>
							   <display:column property="org"
									titleKey="com.application.yffeereimbur.entity.yffeereimbur.listpage.org"
									sortable="true" style="width:5%; text-align:center;" />
							   <display:column title="项目名称"  property="projectName"
									sortable="true" style="width:10%; text-align:center;"/>
						
								<display:column property="projectNo"
									titleKey="com.application.yffeereimbur.entity.yffeereimbur.listpage.projectNo"
									sortable="true" style="width:5%; text-align:center;" />
							    <display:column property="feeType"
									titleKey="com.application.yffeereimbur.entity.yffeereimbur.listpage.feeType"
									sortable="true" style="width:5%; text-align:center;"
									decorator="com.manager.commons.DictCodeColumnDecorator"
									dictCode="FEE_TYPE" />
								<display:column property="applyMoney"
									titleKey="com.application.yffeereimbur.entity.yffeereimbur.listpage.applyMoney"
									sortable="true" style="width:5%; text-align:center;" />

	

								<display:column property="auditStatus"
									title="报销状态"
									sortable="true" style="width:5%; text-align:center;"
									decorator="com.manager.commons.DictCodeColumnDecorator"
									dictCode="AUDIT_STATUS_3" />
	                            <display:column title="流程查看" style=" width:5%; text-align: center;">
								     	<c:choose>
										<c:when test="${yfFeeReimburTab.auditStatus!=1}">
											<a href="#" onclick="viewFlow('${yfFeeReimburTab.processId}');">
												<img src="${pageContext.request.contextPath}/images/015.gif" border="0" alt="查看">
											</a>				
										</c:when>
										<c:otherwise>
												<img src="${pageContext.request.contextPath}/images/013.gif" border="0" alt="不可查看">
										</c:otherwise>
									</c:choose>
								</display:column>		
					
								
							</display:table>
						</fmt:bundle>
					</td>
				</tr>
			</table>

		</html:form>
	</body>
</html>
<script>

function query(){
	document.forms[0].action="listYfFeeReimbur.do?method=getYfFeeReimburPartialList";
	document.forms[0].submit();
}

//新增
function addYfFeeReimbur(){
    document.forms[0].action="toAddYfFeeReimbur.do?method=toAddYfFeeReimbur";
	document.forms[0].submit();
}

//修改
function modifyYfFeeReimbur(){
    var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	        alert("一次只能编辑一条记录！");
		return;
	}else{
	 var cheid = getCheckId().trim();
	    var operateid = cheid + "operateid";
	    var opid = $(operateid).value;
	    var currentid = '${loginUser.id}';
	    if(opid != currentid){
	           alert("只能编辑自己新增的记录！");
	           return;
	    }
	 var auditStatus = getCheckId().trim();
	    var checkedName = auditStatus + "auditStatus";
	    var state = $(checkedName).value;
	    if(state>1){
	        alert("已经提交审核，不能修改！");
	        return;
	    }
		document.forms[0].action="toUpdateYfFeeReimbur.do?method=toUpdateYfFeeReimbur";
	        document.forms[0].submit();
	}
	
}

//删除
function delYfFeeReimbur()
{
  var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	        alert("一次只能删除一条记录！");
		   return;
	}else 
	{
	   var cheid = getCheckId().trim();
	    var operateid = cheid + "operateid";
	    var opid = $(operateid).value;
	    var currentid = '${loginUser.id}';
	    if(opid != currentid){
	           alert("只能删除自己新增的记录！");
	           return;
	    }
		var auditStatus = getCheckId().trim();
	    var checkedName = auditStatus + "auditStatus";
	    var state = $(checkedName).value;
	    if(state>1){
	        alert("已经提交审核，不能删除！");
	        return;
	    }
		if( confirm("是否要删除所选的信息？") )
	{
		document.forms[0].action="deleteYfFeeReimbur.do?method=deleteYfFeeReimbur";
		document.forms[0].submit();
	}
	
	}
}


//修改报销状态
function modifyStatus()
{
  var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	        alert("一次只能修改一条记录！");
		   return;
	}else 
	{
	    var cheid = getCheckId().trim();
	    var operateid = cheid + "operateid";
	    var opid = $(operateid).value;
	    var currentid = '${loginUser.id}';
	    if(opid != currentid){
	           alert("只能修改自己新增的记录！");
	           return;
	    }
		var auditStatus = getCheckId().trim();
	    var checkedName = auditStatus + "auditStatus";
	    var state = $(checkedName).value;
	    if(state!=3){
	        alert("还未审批通过，不能修改状态！");
	        return;
	    }
		if( confirm("是否要修改审核状态为报销成功？") )
	   {
			document.forms[0].action="modifyStatus.do?method=modifyStatus";
		    document.forms[0].submit();
	   }
	
	}
}

	
	
function validateSelect(){ 
    var count = 0;
    var jysBox = $s("id");
    for(var i=0;i<jysBox.length;i++){
		if(jysBox[i].checked){
        	count++;
		}
	}
    return count;
}

//查看
function view(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能查看一条记录！");
		return;
	}else{
		document.forms[0].action="viewYfFeeReimbur.do?method=viewYfFeeReimbur";
	    document.forms[0].submit();
	}
}

//查看
function showView(id){ 
    document.forms[0].action="viewYfFeeReimbur.do?method=viewYfFeeReimbur&id=" + id;
	document.forms[0].submit();

}

//全选   
function checkAll()   
{ 
  
   var chk=document.getElementsByName("id");   
   for(var i=0;i<chk.length;i++)   
   { 
     if($('checkall').checked){
     	chk(i).checked=true; 
     }else{
        chk(i).checked=false; 
     } 
       
 }
  
}   


function getCheckId(){ 
    var count = 0;
    var jysBox = $s("id");
    for(var i=0;i<jysBox.length;i++){
		if(jysBox[i].checked){
        	return jysBox[i].value;
		}
	}
    return count;
}


//提交审核
function submitAudit(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	        alert("一次只能提交一条记录！");
		return;
	}else{
	    var cheid = getCheckId().trim();
	    var operateid = cheid + "operateid";
	    var opid = $(operateid).value;
	    var currentid = '${loginUser.id}';
	    if(opid != currentid){
	           alert("只能提交自己新增的记录！");
	           return;
	    }
	    var auditStatus = getCheckId().trim();
	    var checkedName = auditStatus + "auditStatus";
	    var state = $(checkedName).value;
	    if(state>1){
	        if(state==2){
	           alert("审批中，不能提交！");
	           return;
	        }
	        alert("已审批，不能提交！");
	        return;
	    }
		document.forms[0].action="submitWorkFlowYfFeeReimbur.do?method=submitWorkFlowYfFeeReimbur";
	    document.forms[0].submit();
	}
}  

function viewFlow(processId){
	var url = "<%=path%>/workflow/trace.jsp?processId=" + processId;
	openWindow(url,1100,500);
}


//导出
function exportWord(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能查看一条记录！");
		return;
	}else{
	 var auditStatus = getCheckId().trim();
	    var checkedName = auditStatus + "auditStatus";
	    var state = $(checkedName).value;
	    if(state!=3 && state!=5){
	        alert("还未审批通过，不能导出！");
	        return;
	    }
		var cheid = getCheckId().trim();
	    var operateid = cheid + "operateid";
	    var opid = $(operateid).value;
	    var currentid = '${loginUser.id}';
	    if(opid != currentid){
	           alert("只能导出自己新增的记录！");
	           return;
	    }
		document.forms[0].action="exportYfFeeReimbur.do?method=exportYfFeeReimbur";
	    document.forms[0].submit();
	}
}

</script>
